home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / prntutil / gemgs13 / ps.h < prev    next >
C/C++ Source or Header  |  1995-04-25  |  4KB  |  121 lines

  1. /*
  2.  * ps.h -- Include file for PostScript routines.
  3.  * Copyright (C) 1992  Timothy O. Theisen
  4.  *
  5.  * Modified slightly for use with gemGS on the Atari ST by
  6.  * Tim Gallivan, 8/92.
  7.  *
  8.  * This program is free software; you can redistribute it and/or modify
  9.  * it under the terms of the GNU General Public License as published by
  10.  * the Free Software Foundation; either version 2 of the License, or
  11.  * (at your option) any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  * GNU General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to the Free Software
  20.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  *
  22.  *   Author: Tim Theisen           Systems Programmer
  23.  * Internet: tim@cs.wisc.edu       Department of Computer Sciences
  24.  *     UUCP: uwvax!tim             University of Wisconsin-Madison
  25.  *    Phone: (608)262-0438         1210 West Dayton Street
  26.  *      FAX: (608)262-9777         Madison, WI   53706
  27.  */
  28.  
  29. #ifndef NeedFunctionPrototypes
  30. #if defined(FUNCPROTO) || defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
  31. #define NeedFunctionPrototypes 1
  32. #else
  33. #define NeedFunctionPrototypes 0
  34. #endif /* __STDC__ */
  35. #endif /* NeedFunctionPrototypes */
  36.  
  37.     /* Constants used to index into the bounding box array. */
  38.  
  39. enum {LLX, LLY, URX, URY};
  40.  
  41.     /* Constants used to store keywords that are scanned. */
  42.     /* NNONE is not a keyword, it tells when a field was not set */
  43.  
  44. enum {ATEND = -1, NNONE = 0, PORTRAIT, LANDSCAPE, ASCEND, DESCEND, SPECIAL};
  45.  
  46. #define PSLINELENGTH 257    /* 255 characters + 1 newline + 1 NULL */
  47.  
  48. struct document {
  49.     int  epsf;                /* Encapsulated PostScript flag. */
  50.     char *title;            /* Title of document. */
  51.     char *date;                /* Creation date. */
  52.     int  pageorder;            /* ASCEND, DESCEND, SPECIAL */
  53.     long beginheader, endheader;    /* offsets into file */
  54.     long beginpreview, endpreview;
  55.     long begindefaults, enddefaults;
  56.     long beginprolog, endprolog;
  57.     long beginsetup, endsetup;
  58.     long begintrailer, endtrailer;
  59.     int  boundingbox[4];
  60.     int  default_page_boundingbox[4];
  61.     int  orientation;            /* PORTRAIT, LANDSCAPE */
  62.     int  default_page_orientation;    /* PORTRAIT, LANDSCAPE */
  63.     unsigned int nummedia;
  64.     struct documentmedia *media;
  65.     struct documentmedia *default_page_media;
  66.     unsigned int numpages;
  67.     struct page *pages;
  68. };
  69.  
  70. struct page {
  71.     char *label;
  72.     int  boundingbox[4];
  73.     struct documentmedia *media;
  74.     int  orientation;            /* PORTRAIT, LANDSCAPE */
  75.     long begin, end;            /* offsets into file */
  76. };
  77.  
  78. struct documentmedia {
  79.     char *name;
  80.     int width, height;
  81. };
  82.  
  83.     /* list of standard paper sizes from Adobe's PPD. */
  84.  
  85. extern struct documentmedia papersizes[];
  86.  
  87.     /* scans a PostScript file and return a pointer to the document
  88.        structure.  Returns NULL if file does not Conform to commenting
  89.        conventions . */
  90.  
  91. #if NeedFunctionPrototypes
  92. struct document *psscan(FILE *);
  93. #else
  94. struct document *psscan();
  95. #endif
  96.  
  97.     /* free data structure malloc'ed by psscan */
  98.  
  99. #if NeedFunctionPrototypes
  100. void psfree(struct document *);
  101. #else
  102. void psfree();
  103. #endif
  104.  
  105.     /* Copy a portion of the PostScript file */
  106.  
  107. #if NeedFunctionPrototypes
  108. void pscopy(FILE *from, FILE *to, long begin, long end);
  109. #else
  110. void pscopy();
  111. #endif
  112.  
  113.     /* Copy a portion of the PostScript file upto a comment */
  114.  
  115. #if NeedFunctionPrototypes
  116. char *pscopyuntil(FILE *from, FILE *to, long begin, long end,
  117.           const char *comment);
  118. #else
  119. char *pscopyuntil();
  120. #endif
  121.